/* 商品购买数加减号切换
   1 - add addDown
   2 - dec decDown
   3 - addDown - add
   4 - decDown - dec
*/
function replaceAddOrDecImage(obj, type) {
    if (type === 1) {
        $(obj).attr("src", "/images/AddDown.png");
    }
    else if (type === 2) {
        $(obj).attr("src", "/images/DecDown.png");
    }
    else if (type === 3) {
        $(obj).attr("src", "/images/Add.png");
    }
    else if (type === 4) {
        $(obj).attr("src", "/images/Dec.png");
    }
}
function userInfoHover(obj, type) {
    if (1 == type) {
        $(obj).attr("src", "/images/user_down.png");
    } else {
        $(obj).attr("src", "/images/user_normal.png");
    }
}

/* 登录头像切换
   1 - 按下
   2 - 按下结束
*/
function replaceLoginImage(obj, type) {
    if (type == 1) {
        $(obj).attr("src", "/images/icon_down.png");
    }
    else if (type == 2) {
        $(obj).attr("src", "/images/icon_normal.png");
    }
}
//返回图标切换
function replaceBackImage(obj, type) {
    if (type == 1) {
        $(obj).attr("src", "/images/return_2.png");
    }
    else if (type == 2) {
        $(obj).attr("src", "/images/return_1.png");
    }
}
//登录页返回图标切换
function replaceBackImageLogin(obj, type) {
    if (type == 1) {
        $(obj).attr("src", "/images/return_4.png");
    }
    else if (type == 2) {
        $(obj).attr("src", "/images/return_3.png");
    }
}
//登录页清除密码图标切换
function replaceBackImageCancel(obj, type) {
    if (type == 1) {
        $(obj).attr("src", "/images/clear1.png");
    }
    else if (type == 2) {
        $(obj).attr("src", "/images/clear2.png");
    }
}
//滚动
function isScroll(scrollWindow, scrollDoc, scrollCallBack) {
    $(scrollWindow).scroll(function () {
        var scrollTop = $(this).scrollTop();
        var windowHeight = $(this).height();
        var docHeight = $(scrollDoc).height();
        if (scrollTop >= (docHeight - windowHeight)) {
            if (scrollCallBack) {
                scrollCallBack();
            };
        }
    });
}
//拼接注册页的url
function spliceRegisterUrl(returnUrl, turnBackurl) {
    return '/Register/Index?returnUrl=' + returnUrl + '&turnBackurl=' + turnBackurl;
}